<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: csnf
  Date: 2024/12/23
  Time: 17:25
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>编辑学生信息</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            background-color: #f4f4f4;
            margin: 0;
            padding: 0;
            display: flex;
            justify-content: center;
            align-items: center;
            min-height: 100vh;
        }
        .container {
            width: 100%;
            max-width: 500px;
            margin: 50px auto;
            background: white;
            padding: 20px;
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
            border-radius: 8px;
            animation: fadeIn 0.5s ease-in-out;
        }
        @keyframes fadeIn {
            from { opacity: 0; }
            to { opacity: 1; }
        }
        h1 {
            text-align: center;
            color: #333;
            margin-bottom: 20px;
        }
        form {
            display: flex;
            flex-direction: column;
        }
        label {
            margin-bottom: 10px;
            font-weight: bold;
        }
        input[type="text"], input[type="date"], select {
            padding: 10px;
            margin-bottom: 15px;
            border: 1px solid #ccc;
            border-radius: 4px;
            transition: border-color 0.3s ease;
        }
        input[type="text"]:focus, input[type="date"]:focus, select:focus {
            border-color: #007bff;
        }
        input[type="radio"] {
            margin-right: 5px;
        }
        .radio-group {
            display: flex;
            align-items: center;
            margin-bottom: 15px;
        }
        input[type="submit"], input[type="reset"] {
            padding: 10px 20px;
            background-color: #28a745;
            color: white;
            border: none;
            border-radius: 4px;
            cursor: pointer;
            transition: background-color 0.3s ease;
        }
        input[type="submit"]:hover, input[type="reset"]:hover {
            background-color: #218838;
        }
        a {
            display: block;
            text-align: center;
            margin-top: 20px;
            text-decoration: none;
            color: #007bff;
            transition: color 0.3s ease;
        }
        a:hover {
            text-decoration: underline;
            color: #0056b3;
        }
        /* 确保默认选项正确显示 */
        select option:first-child {
            background-color: #f8f9fa;
            color: #6c757d;
        }
    </style>
</head>
<body>
<div class="container">
    <h1>编辑学生信息</h1>
    <form action="Studentservlet" method="post">
        <input type="hidden" name="sId" value="${stu.sId}">

        <label for="sName">学生姓名:</label>
        <input type="text" id="sName" name="sName" value="${stu.sName}" required>

        <label for="birth">生日:</label>
        <input type="date" id="birth" name="birth" value="${stu.birth}" required>

        <div class="radio-group">
            <label>
                <input type="radio" name="gender" value="男" ${stu.gender == '男' ? 'checked' : ''}>男
            </label>
            <label>
                <input type="radio" name="gender" value="女" ${stu.gender == '女' ? 'checked' : ''}>女
            </label>
        </div>

        <label for="clazzId">请选择班级:</label>
        <select id="clazzId" name="clazzId" required>
            <option value="" disabled ${empty stu.clazz.cId ? 'selected' : ''}>请选择班级</option>
            <option value="${stu.clazz.cId}" selected>${stu.clazz.cName}</option>
            <c:forEach items="${clazzList}" var="clazz">
                <option value="${clazz.cId}" ${clazz.cId == stu.clazz.cId ? 'disabled' : ''}>${clazz.cName}</option>
            </c:forEach>
        </select>

        <input type="submit" value="提交">
        <input type="reset" value="重置">
        <a href="StudentList.jsp">返回</a>
    </form>
</div>
</body>
</html>
